﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NJ.Models;
using NJ.ViewModels;
using System.Linq.Dynamic.Core;

namespace NJ.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult LuXian()
        {
            return View();
        }

        public IActionResult JuShi()
        {
            return View();
        }

        public IActionResult ShangWang()
        {
            return View();

        }

        public IActionResult ZhengYan()
        {
            return View();
        }

        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        public JsonResult GetNums()
        {
            var context = new NJContext();
            var sql = context.Progress
                .OrderBy("Id")
                .Select("new(Id as ID,Timeno as TIMENO,Number as NUMBER,X,Y)");
            var items = sql.ToDynamicList();

            return Json(items);
        }
    }
}
